package cn.kgc.mcartoon.controller;

import cn.kgc.mcartoon.dto.ResultDto;
import cn.kgc.mcartoon.service.FileUpLoadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("/api/file/")
public class FileUploadController {

    @Autowired
    private FileUpLoadService fileUpLoadService;

    @PostMapping("file_upload")
    public ResultDto upload(MultipartFile file) throws IOException {
        return fileUpLoadService.upload(file);
    }
}
